//
//  Person.m
//  链式编程和函数编程
//
//  Created by 383Mac on 2017/9/29.
//  Copyright © 2017年 383Mac. All rights reserved.
//

#import "Fouction.h"

@implementation Fouction



-(void)dosomething{
    NSLog(@"dosomething 吃");
}
-(void)working{
    NSLog(@"working 工作");
}

#pragma mark- 链式编程 返回自身对象方便调用

-(Fouction *)dosomething2{
    
    //执行操作办法
       NSLog(@"dosomething 吃");
    return  self;
}

-(Fouction *)working2{
    
    //执行操作办法
    NSLog(@"working");
    return  self;
}


#pragma mark- 函数式编程

-(Fouction *(^)(void))dosomething3{
    
    Fouction *(^runBlock)(void) = ^ () {
        
        NSLog(@"执行了不带参数的函数方法");
        return self;
    };
    return runBlock;
    
 //   改进写法
//    return ^(){
//        NSLog(@"Block Run2");
//        return self;
//    };
}

-(Fouction *(^)(void))working3 {
    
    return ^() {
        NSLog(@"执行了无参数的方法");
        return self;
    };
    
}

-(Fouction *(^)(NSString *))working4 {
    
    Fouction *(^myBlock)(NSString *str) = ^(NSString *str) {
         NSLog(@"执行了传值过来的参数方法--%@",str);
        
        return self;
    };
    
    return myBlock;
    
    
//    return ^(NSString *str) {
//
//        NSLog(@"执行了传值过来的参数方法--%@",str);
//        return self;
//    };
}











@end
